/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.synjones.zeuscloudapp.util;

import com.synjones.core.util.RequestUtil;
import com.synjones.zeuscloudapp.bean.MessageBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.http.HttpServletRequest;

/**
 * @author tnnan
 */
public class MessageInfoUtil {
    private static final Logger LOG = LoggerFactory.getLogger(MessageInfoUtil.class);
    public static MessageBean getMessageInfo(HttpServletRequest request) {
        String organizationCode = request.getHeader("organizationCode");
        String apiVersion = request.getHeader("apiVersion");
        String dateTime = request.getHeader("dateTime");
        String appVersion = request.getHeader("appVersion");
        String clientType = request.getHeader("clientType");
        String clientMark = request.getHeader("clientMark");
        String iplanetdirectorypro = request.getHeader("iplanetdirectorypro");
        String imei = request.getHeader("imei");
        String clientIp = request.getHeader("clientIp");
        String magic = request.getHeader("magic");
        LOG.info("接收到Header中的数据为：organizationCode={},apiVersion={},dateTime={},appVersion={},clientType={},"
                        + "clientMark={},iplanetdirectorypro={},imei={},clientIp={},magic={},外网IP为{}", organizationCode, apiVersion
                , dateTime, appVersion, clientType, clientMark, iplanetdirectorypro, imei, clientIp,magic,RequestUtil.getClientIP(request));
        return new MessageBean(organizationCode, apiVersion, dateTime, appVersion, clientType, clientMark, iplanetdirectorypro, imei, clientIp,magic);
    }
}
